#include<iostream>
#include<vector>

using namespace std;

int n , m;
vector<int>ret;

void dfs(int begin)
{
    if(ret.size() == m)
    {
        for(auto e : ret)  cout << e << " ";
        cout << endl;
        return;
    }

    for(int i = begin;i <= n;i ++)
    {
        ret.push_back(i);
        dfs(i + 1);
        ret.pop_back();
    }
}
int main()
{
    cin >> n >> m;
    dfs(1);
    return 0;
}